Crate jetscii [] [src]

A tiny library to efficiently search strings for substrings or sets of ASCII characters.

Examples

Searching for a set of ASCII characters

#[macro_use]
extern crate jetscii;

fn main() {
    let part_number = "86-J52:rev1";
    let parts: Vec<_> = part_number.split(ascii_chars!('-', ':')).collect();
    assert_eq!(&parts, &["86", "J52", "rev1"]);
}

Searching for a substring

use jetscii::Substring;

let colors: Vec<_> = "red, blue, green".split(Substring::new(", ")).collect();
assert_eq!(&colors, &["red", "blue", "green"]);

Macros

ascii_chars

A convenience constructor for an AsciiChars that automatically implements a fallback. Provide 1 to 16 characters.

Structs

AsciiChars

Searches a string for a set of ASCII characters. Up to 16 characters may be used.

AsciiCharsWithFallback

Provides a hook for a user-supplied fallback implementation, used when the optimized instructions are not available.

DirectSearcher

A searcher implementation for DirectSearch types.

Substring

Search a string for a substring.

Traits

DirectSearch

Types that return the index of the next match.